using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace CLZ.Data
{
	public static class TableMarkets
	{
		public const string Table = "Markets";
		public const string MarketsID = "MarketsID";
		public const string MarketsName = "MarketsName";
		public const string Address = "Address";
		public const string Remarks = "Remarks";
		public const string RegionID = "RegionID";
	}
	
	[Serializable]
	public class BaseMarkets
		: IDbSessionEntity, IJsonClass
	{
		int m_MarketsID;
		/// <summary>
        /// 
        /// </summary>
        public int MarketsID
        {
            get { return m_MarketsID; }
            set { m_MarketsID = value; }
        }
		
		string m_MarketsName;
		/// <summary>
        /// 
        /// </summary>
        public string MarketsName
        {
            get { return m_MarketsName; }
            set { m_MarketsName = value; }
        }
		
		string m_Address;
		/// <summary>
        /// 
        /// </summary>
        public string Address
        {
            get { return m_Address; }
            set { m_Address = value; }
        }
		
		string m_Remarks;
		/// <summary>
        /// 
        /// </summary>
        public string Remarks
        {
            get { return m_Remarks; }
            set { m_Remarks = value; }
        }
		
		int? m_RegionID;
		/// <summary>
        /// 
        /// </summary>
        public int? RegionID
        {
            get { return m_RegionID; }
            set { m_RegionID = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_MarketsID = reader[TableMarkets.MarketsID];
            m_MarketsName = reader[TableMarkets.MarketsName];
            m_Address = reader[TableMarkets.Address];
            m_Remarks = reader[TableMarkets.Remarks];
            m_RegionID = reader[TableMarkets.RegionID];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableMarkets.MarketsID, PrimaryKeyType.Identity, MarketsID);
			writer[TableMarkets.MarketsName] = MarketsName;
			writer[TableMarkets.Address] = Address;
			writer[TableMarkets.Remarks] = Remarks;
			writer[TableMarkets.RegionID] = RegionID;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_MarketsID = idd;
        }
		
		public string TableName
        {
            get { return TableMarkets.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_MarketsID = hashToRead["MarketsID"];
			 
             m_MarketsName = hashToRead["MarketsName"];
			 
             m_Address = hashToRead["Address"];
			 
             m_Remarks = hashToRead["Remarks"];
			 
             m_RegionID = hashToRead["RegionID"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["MarketsID"] = MarketsID;
			 
            hashToFill["MarketsName"] = MarketsName;
			 
            hashToFill["Address"] = Address;
			 
            hashToFill["Remarks"] = Remarks;
			 
            hashToFill["RegionID"] = RegionID;
			 
        }

        #endregion
		
	}
}
